package MyLinkedList;

public class Test{
    //测试MyList的创建,打印,大小,查找元素
    public static void test1(){
        MyList list = new MyList();
        list.createList();
        list.display();
        System.out.println("list的len为: " + list.size());
        System.out.println(list.contains(11));
        System.out.println(list.contains(123));
    }
    //测试MyList的加减,头插,尾插,任意下标插入
    public static void test2(){
        MyList list = new MyList();
        list.createList();
        list.display();
        list.addFirst(88);
        list.display();
        list.addLast(99);
        list.display();
        //头插
        list.addIndex(0,111);
        //尾插
        list.addIndex(list.size(),222);
        //随便插
        list.addIndex(4,333);
        list.display();
    }
    //测试部分删除
    public static void test3(){
        MyList list = new MyList();
        list.createList();
        list.display();
        list.remove(11);
        list.display();
        list.remove(33);
        list.display();
        list.remove(44);
        list.display();
    }
    //测试全部删除
    public static void test4(){
        MyList list = new MyList();
        list.createList();
        list.addFirst(11);
        list.addFirst(22);
        list.addFirst(33);
        list.addFirst(44);
        list.display();
        list.removeAllKey(11);
        list.display();
        list.removeAllKey(33);
        list.display();
        list.removeAllKey(44);
        list.display();
        list.removeAllKey(22);
        list.display();
        list.createList();
        list.display();
        list.clear();
        list.display();
    }
    public static void main(String[] args) {
        //test1();
        //test2();
        //test3();
        test4();
    }
}
